package cn.wolfcode.crm.service.Impl;

import cn.wolfcode.crm.domain.SystemDictionaryItem;
import cn.wolfcode.crm.mapper.SystemDictionaryItemMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ISystemDictionaryItemService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
@Transactional
public class SystemDictionaryItemSreviceImpl implements ISystemDictionaryItemService {

    @Autowired
    private SystemDictionaryItemMapper systemDictionaryItemMapper;
    @Override
    public void save(SystemDictionaryItem systemDctionaryItem) {
        systemDictionaryItemMapper.insert(systemDctionaryItem);
    }

    @Override
    public void delete(Long id) {
        systemDictionaryItemMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(SystemDictionaryItem systemDctionaryItem) {
        systemDictionaryItemMapper.updateByPrimaryKey(systemDctionaryItem);
    }

    @Override
    public SystemDictionaryItem get(Long id) {
        return systemDictionaryItemMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionaryItem> list() {
        return systemDictionaryItemMapper.selectAll();
    }

    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<SystemDictionaryItem> systemDctionaryItems = systemDictionaryItemMapper.selectForList(qo);
        return new PageInfo(systemDctionaryItems);
    }

    @Override
    public List<SystemDictionaryItem> queryBysystemDictionarySn(String job) {

        return systemDictionaryItemMapper.queryBysystemDictionarySn(job);
    }

    @Override
    public List<SystemDictionaryItem> selectMy() {
        return null;
    }
}
